<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>邀请函</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <style type="text/css">
        @charset "UTF-8";
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        ul, dl, ol, li {
            list-style: none;
        }
        img, input[type="submit"] {
            border: 0 none;
        }
        em { font-style: normal; }
        strong { font-weight: normal; }
        table {
            border-collapse: collapse;
            border-spacing: 0;
        }
        button, input[type="button"] {
            cursor: pointer;
            border: 0 none;
        }
        a, button, input, img {
            -webkit-touch-callout: none;
        }
        img {
            pointer-events: none;
        }
        input, select, textarea {
            outline: none;
        }
        a {
            color: inherit;
            text-decoration: none;
        }
        html, body {
            -moz-user-select: none;
            -webkit-user-select: none;
            -ms-user-select: none;
            user-select: none;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
        }
        html {
            height: 100%;
            width: 100%;
            -webkit-text-size-adjust: none;
        }
        body {
            height: 100%;
            position: relative;
            overflow: hidden;
        }
        * {
            font-family: Helvetica, Tahoma, Arial, "Microsoft YaHei", SimSun, Heiti, sans-serif;
        }
        .clearfix::after {
            content: "";
            display: block;
            clear: both;
        }
        body {
            width: 100%;
        }
        .pho {
            width: 100%;
            height: 100%;
            overflow: hidden;
        }
        .invitation-container {
            position: relative;
            width: 100%;
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            background: #86202D url(../img/dian.png);
            padding: 3vmin;
            border-radius: 10px;
            height: 100%;
            min-height: 100%;
        }
        .pic-section {
            flex: 1;
            border: 1px solid #F5A273;
            padding: 2vmin;
            text-align: center;
            margin-bottom: 3vmin;
            display: flex;
            flex-direction: column;
        }
        .pic-inner {
            border: 1px solid #F5A273;
            padding: 2vmin;
            text-align: center;
            height: 100%;
            display: flex;
            flex-direction: column;
        }
        #pic-container {
            cursor: pointer;
            position: relative;
            margin: 2vmin auto;
            border: 2px solid #F5A273;
            flex: 1;
            overflow: hidden;
            width: 90%;
        }
        #pic {
            width: 100%;
            height: 100%;
            background-size: cover;
            background-position: center;
        }
        #pic-hint {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: rgba(245, 162, 115, 0.9);
            font-size: 1.5vmin;
            background-color: rgba(0, 0, 0, 0.5);
            padding: 0.8vmin 1.6vmin;
            border-radius: 5px;
            opacity: 0;
            transition: opacity 0.3s ease;
            pointer-events: none;
        }
        #pic-container:hover #pic-hint {
            opacity: 1;
        }
        #image-upload {
            display: none;
        }
        .title-section {
            margin: 2vmin 0;
            flex-shrink: 0;
        }
        .info-section {
            flex: 1;
            border: 1px solid #F5A273;
            padding: 2vmin;
            display: flex;
            flex-direction: column;
        }
        .info-inner {
            border: 1px solid #F5A273;
            padding: 3vmin;
            text-align: center;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: space-around;
        }
        @font-face {
            font-family: 'MyFontGB2312';
            src: url('../font/MyFont-GB2312.TTF') format('truetype');
            font-display: swap;
        }
        @font-face {
            font-family: 'MyFontGB2313';
            src: url('../font/MyFont-GB2313.ttf') format('truetype');
            font-display: swap;
        }
        @media (min-width: 768px) {
            .invitation-container {
                flex-direction: row;
            }
            .pic-section {
                margin-right: 3vmin;
                margin-bottom: 0;
                min-width: 45%;
            }
            .info-section {
                min-width: 45%;
            }
        }
        @media (max-width: 767px) {
            .info-inner {
                justify-content: space-between;
                gap: 1vmin;
            }
            .title-section {
                margin: 1.5vmin 0;
            }
        }
    </style>
</head>
<body>
    <div class="pho">
        <div class="invitation-container">
            <div class="pic-section">
                <div class="pic-inner">
                    <div id="pic-container">
                        <div id="pic"></div>
                        <div id="pic-hint">点击更换图片</div>
                        <input type="file" id="image-upload" accept="image/*">
                    </div>
                    <div class="title-section">
                        <font style="color:#F5A273;font-size:5vmin;padding-right:1vmin;">囍</font>
                        <font style="font-family: 'MyFontGB2313';font-size:4vmin;color:#F5A273;">婚礼</font>
                        <font style="color:#F5A273;font-size:5vmin;padding-left:1vmin;">囍</font>
                        <font style="color:#F5A273;padding-left:1vmin;font-size:2vmin;">Wedding Invitation</font>
                    </div>
                    <div class="title-section">
                        <font style="color:#F5A273;font-size:6vmin;">囍</font>
                        <font style="font-family: 'MyFontGB2313';font-size:4vmin;color:#F5A273;padding-left:1vmin;">请柬</font>
                        <font style="color:#F5A273;font-size:6vmin;padding-left:1vmin;">囍</font>
                    </div>
                </div>
            </div>
            <div class="info-section">
                <div class="info-inner">
                    <div style="border:5px solid #F5A273;width:15vmin;text-align:center;padding:1vmin;">
                        <div style="font-size:4vmin;color:#F5A273;">吾家</div>
                        <div style="font-size:4vmin;color:#F5A273;">有喜</div>
                    </div>
                    <div style="color:#F5A273;font-size:10vmin;">囍</div>
                    <div style="text-align:left;;">
                        <font style="color:#F5A273;font-size:2vmin;">新郎：</font>
                        <font style="font-family: 'MyFontGB2312';font-size:4vmin;" contenteditable="true">XXX</font>
                        <font style="color:#F5A273;font-size:2vmin;padding-left:2vmin;">新娘：</font>
                        <font style="font-family: 'MyFontGB2312';font-size:4vmin;" contenteditable="true">XXX</font>
                    </div>
                    <div style="text-align:left;;">
                        <font style="color:#F5A273;font-size:2vmin;">谨定于：</font>
                        <font style="font-family: 'MyFontGB2312';font-size:4vmin;" contenteditable="true">公历XXXX年XX月XX日</font>
                        <div>
                            <font style="padding-left:8vmin;font-family: 'MyFontGB2312';font-size:4vmin;" contenteditable="true">农历XXXX年XX月XX</font>
                        </div>
                    </div>
                    <div style="text-align:left;;">
                        <font style="color:#F5A273;font-size:2vmin;">时间：</font>
                        <font style="font-family: 'MyFontGB2312';font-size:4vmin;" contenteditable="true">下午XX:XX</font>
                    </div>
                    <div style="text-align:left;;word-break: break-all;">
                        <font style="color:#F5A273;font-size:2vmin;">席设：</font>
                        <font style="font-family: 'MyFontGB2312';font-size:4vmin;" contenteditable="true">XX省XX市XX区XX栋XX号</font>
                    </div>
                    <div style="text-align:center;;">
                        <font style="color:#F5A273;font-size:3vmin;">举办结婚喜宴</font>
                    </div>
                    <div style="text-align:center;;">
                        <font style="color:#F5A273;font-size:3vmin;">敬备薄酒 恭请光临</font>
                    </div>
                    <div style="text-align:right;margin-top:1.5vmin;">
                        <font style="font-family: 'MyFontGB2312';font-size:4vmin;padding-right:10vmin;" contenteditable="true">XXX</font>
                    </div>
                    <div style="text-align:right;">
                        <font style="font-family: 'MyFontGB2312';font-size:4vmin;padding-right:3vmin;" contenteditable="true">XXX</font>
                        <font style="color:#F5A273;font-size:3vmin;">敬邀</font>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="../js/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            const picContainer = document.getElementById('pic-container');
            const imageUpload = document.getElementById('image-upload');
            const pic = document.getElementById('pic');

            if (picContainer.addEventListener) {
                picContainer.addEventListener('click', handlePicClick);
            } else if (picContainer.attachEvent) {
                picContainer.attachEvent('onclick', handlePicClick);
            }

            function handlePicClick(e) {
                e = e || window.event;
                if (e.stopPropagation) {
                    e.stopPropagation();
                } else {
                    e.cancelBubble = true;
                }
                imageUpload.click();
                clearInterval(imageInterval);
            }

            imageUpload.addEventListener('change', function(e) {
                const file = e.target.files[0];
                if (!file) return;

                if (!file.type.match('image.*')) {
                    alert('请选择图片文件！');
                    return;
                }

                const reader = new FileReader();
                reader.onload = function(event) {
                    pic.style.backgroundImage = `url(${event.target.result})`;
                };
                reader.readAsDataURL(file);
            });
        });

    </script>
</body>
</html>
